package WaiBao;

import java.util.Arrays;

public class LiSiBei {
    public static void main(String[] args) {
        String[] mingzi = {"刘梦舒(班长)", "张大胖(团支书)", "小李(学习委员)", "李浩(体育委员)", "王佳", "王凯", "王子文", "王小涛", "小黑黑", "大白白", "冰墩墩", "鼠大厨",
                "松鼠", "吉吉", "毛毛", "熊大", "熊二", "翠花", "宙斯", "张三", "王五", "王金文", "王靖雯", "杨明", "王明生", "王道华", "王皓", "朱子豪",
                "朱世康", "李思蓓(文艺委员)"};//考生本人: 李思蓓(文艺委员)
        int[] nainling = {21, 20, 19, 18, 20, 21, 21, 21, 19, 19, 18, 19, 18, 20, 22, 20, 18, 21, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁

        double[] maomi1 = {74, 86, 64, 70, 78, 69, 78, 84, 83, 80, 90, 87, 81, 79, 65, 78, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 94};
        double[] maomi2 = {85, 75, 84, 79, 84, 67, 61, 79, 80, 94, 90, 70, 86, 74, 95, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[] maomi3 = {74, 91, 94, 85, 71, 61, 78, 80, 84, 60, 63, 87, 65, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double hetao;//代表每个学生的总分
        double guazi;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            hetao  = maomi1[i] + maomi2[i] +maomi3[i];
//            guazi = (hetao * 1.0) / 3;
//            System.out.println(mingzi[i] + "的总分为:" + hetao);
//            System.out.println(mingzi[i] + "的平均分为:" +guazi);
//        }


        double xingren1 = 0, xingren2 = 0;
        double[] badanmu = new double[30];
//        for (int i = 0; i < 30; i++) {
//            xingren1 = maomi1[i] + maomi2[i] + maomi3[i];
//            xingren2= (xingren1 * 1.0) / 3;
//            badanmu [i] = xingren2;
//        }
//
//        for (int i = 0; i < badanmu .length - 1; i++) {
//            for (int j = 0; j < badanmu .length - i - 1; j++) {
//                if (badanmu [j] < badanmu [j + 1]) {
//                    double tep = badanmu [j];
//                    badanmu [j] = badanmu [j + 1];
//                    badanmu [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(badanmu[i]);
//        }



        double jianguo1 = 0,jianguo2 = 0, jianguo3 = 0;//计算每门课的平均分
        double taobao1 = 0,taobao2 = 0, taobao3 = 0;//计算每门课标准差
        double dongzi1 = 0,dongzi2 = 0, dongzi3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < maomi1.length; i++) {
            sum2+=maomi1[i];
        }
        jianguo1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+jianguo1);
        double Sum = 0;
        for (int i = 0; i <maomi2.length; i++) {
            Sum+=maomi2[i];
        }
        jianguo2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+jianguo2);
        double sum = 0;
        for (int i = 0; i <maomi3.length; i++) {
            sum+=maomi3[i];
        }
        jianguo3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+jianguo3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <maomi1.length; i++) {
            c1+= (maomi1[i] - jianguo1)*(maomi1[i] -jianguo1);
        }
        taobao1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+taobao1);

        for (int i = 0; i < maomi2.length; i++) {
            c2+= (maomi2[i] - jianguo2)*(maomi2[i] - jianguo2);
        }
        taobao2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+taobao2);

        for (int i = 0; i < maomi3.length; i++) {
            c3+= (maomi3[i] -jianguo3)*(maomi3[i] - jianguo3);
        }
        taobao3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+taobao3);
//////
//        Arrays.sort(maomi1);
//        Arrays.sort(maomi2);
//        Arrays.sort(maomi3);
//        dongzi1 =( maomi1[14]+maomi1[15])*1.0/2;
//        dongzi2 =( maomi2[14]+maomi2[15])*1.0/2;
//        dongzi3 =( maomi3[14]+maomi3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+dongzi1);
//        System.out.println("微生物学的中位数为:"+dongzi2);
//        System.out.println("人体组织解剖学的中位数为:"+dongzi3);
//



    }
}
